﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using RN.ERP.Entity;
using RN.ERP.DTO;
using Fly.Common.WorkFlow;
using RN.ERP.Entity.ZBDLRY;

namespace RN.ERP.BLL
{
    public abstract class BaseBasicBLL : IBll
    {
        protected DbContext baseContext;

        public virtual string DoLogin(string userName, string password, string userType, string systemid)
        {
            return string.Empty;
        }

        public virtual string DoLogin(string userName, string password, string dogId, string userType, string systemid)
        {
            return string.Empty;
        }

        public virtual string DoLoginWithAuthority(string userName, string password, string dogId, string groupType, string appId)
        {
            return string.Empty;
        }

        public virtual string DoLoginWithAuthority(string userGuid, string appId)
        {
            return string.Empty;
        }
        /// <summary>
        /// 通过企业组织机构代码获取企业信息
        /// </summary>
        /// <param name="OrginazationCode"></param>
        /// <returns></returns>
        public virtual List<DTO.Tb_Corp_CompanyInfo> GetCompanyInfo(string OrginazationCode, string areaCode)
        {
            return null;
        }

        protected virtual UserInfo InitUserAuthority(UserInfo userInfo, string appId)
        {
            return userInfo;
        }
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="userGuid"></param>
        /// <param name="newPwd"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual bool ResetPassword(Guid userGuid, string newPwd, string areaCode)
        {
            return false;
        }
        /// <summary>
        /// 重置组织机构代码
        /// </summary>
        /// <param name="userGuid"></param>
        /// <param name="newPwd"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual bool ResetOrginazationCode(Guid userGuid, string newCode, string areaCode)
        {
            return false;
        }

        /// <summary>
        /// 根据key号获取用户信息，含用户是否主管
        /// </summary>
        /// <param name="dogid"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetUserInfobyDogID(int dogid, string areaCode)
        {
            return "";
        }

        protected virtual UserInfo GetUserInfo(
            string userName,
            string password,
            string dogId,
            bool allowLoginWithoutKey)
        {
            return null;
        }

        public virtual string GetUserInfo(string userguid, string areaCode)
        {
            return string.Empty;
        }

        public virtual string GetDictionaryTitleByCode(string code, string type, string areaCode)
        {
            return string.Empty;
        }

        public virtual string GetDictionary(string type, string condition, string areaCode)
        {
            return string.Empty;
        }

        public virtual IList<DTO.a_AreaSSQ> BindDdlistArea(DTO.a_AreaSSQ areaInfo, string areaCode)
        {
            return null;
        }

        #region 变更功能。

        public virtual string GetChangeItems(string changeType, string appId, string areaCode)
        {
            return string.Empty;
        }

        /// <summary>
        /// 添加变更申请
        /// </summary>
        /// <param name="changeInfo"></param>
        /// <returns></returns>
        public virtual string AddChange(string changeSetInfo, string changeInfo, string changeType, string userGuid, string userRole, string userName, string areaCode)
        {
            return string.Empty;
        }

        public virtual string EditChange(string changeSetInfo, string changeInfo, string changeType, string userGuid, string userRole, string userName, string areaCode)
        {
            return string.Empty;
        }

        public virtual string DeleteChange(string changeId, string changeType, string userGuid, string userRole, string userName, string areaCode)
        {
            return string.Empty;
        }

        /// <summary>
        /// 上报变更申请集合
        /// </summary>
        /// <param name="changeId"></param>
        /// <returns></returns>
        public virtual string SubmitChange(string changeIds, string changeType, string userGuid, string userRole, string userName, string areaCode)
        {
            return string.Empty;
        }

        public virtual string AuditChange(string changeId, string flowCode, string description, bool isFinal, string changeType, string userGuid, string userRole, string userName, string areaCode)
        {
            return string.Empty;
        }

        public virtual string GetBeforeChangeValue(string changeItem, string areaCode, params string[] parameters)
        {
            return string.Empty;
        }

        public virtual string GetBindChangeValue(string changeItem, string areaCode, params string[] parameters)
        {
            return string.Empty;
        }

        public virtual string GetChanges(string changeType, string corpUserGuid, string flowCode, string condition, int pageIndex, int pageSize, out int count, string areaCode)
        {
            count = 0;
            return string.Empty;
        }

        public virtual string GetChangeDetails(string changeType, int changeSetId, string areaCode)
        {
            return string.Empty;
        }

        public virtual string AuditLogs(string objectId, string areaCode)
        {
            return string.Empty;
        }

        public virtual string CheckChange(string changeSetId, string userRole, string areaCode)
        {
            return string.Empty;
        }

        public virtual List<DTO.tb_Emp_Manager> GetChangeEmpList(string conditions, int pageCount, int pageSize)
        {
            return null;
        }

        public virtual int GetChangeEmpCount(string conditions)
        {
            return 0;
        }

        /// <summary>
        /// 返回变更项需要上传的图片
        /// </summary>
        /// <returns></returns>
        public virtual string GetChangeItemUploadImg(string uploadID, string areaCode)
        {
            return null;
        }
        #endregion

        #region 人员资格
        public virtual List<DTO.tb_Emp_TitleType> GetPsnQualLevelByType(int nid, string areaCode)
        {
            return null;
        }
        public virtual List<DTO.a_Speciality> GetPsnspecialtyByQualLType(int nid, string areaCode)
        {
            return null;
        }
        /// <summary>
        /// 根据资格guid获取资格明细
        /// </summary>
        /// <param name="qulaiguid"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual DTO.PsnQulaDDValue GetPersonQualityByGid(string qulaiguid, string areaCode)
        {
            return null;
        }
        #endregion 人员资格

        #region 企业资质相关
        public virtual List<DTO.KeyValue> GetCorpQualLevByUserGuid(int roleid, string areaCode)
        {
            return null;
        }
        public virtual List<DTO.CorpKindKeyAndValue> GetCorpQualTypesByUserGuid(int roleid, int classid, string areaCode)
        {
            return null;
        }
        public virtual DTO.QulaDDValue GetCorpQualByGuid(string guid, string areaCode)
        {
            return null;
        }

        #endregion 企业资质相关

        /// <summary>
        /// 根据条件获取资质或资格的字典关系。
        /// </summary>
        /// <param name="rootCode">根节点编号。</param>
        /// <param name="parentId">父节点编号。</param>
        /// <returns></returns>
        public virtual IList<DictQualityInfo> GetQualitiesDic(string rootCode, string parentId)
        {
            return null;
        }
        public virtual IList<DTO.DictQualityInfo> GetQualitiesDicAll(string rootCode, string parentId, string childRootCode)
        {
            return null;
        }
        /// <summary>
        /// 获取资质或资格的内容。
        /// </summary>
        /// <param name="rootCode"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public virtual string GetQualityTitle(string rootCode, string code)
        {
            return null;
        }

        /// <summary>
        /// 获取市级
        /// </summary>
        /// <returns></returns>
        public virtual List<DTO.a_AreaInfo> GetCity()
        {
            return null;
        }

        /// <summary>
        /// 获取区级
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public virtual List<DTO.a_AreaSubInfo> GetQu(string code)
        {
            return null;
        }

        public virtual string GetAddress(string code)
        {
            return string.Empty;
        }

        public virtual List<DTO.T_Sys_FuncPageMapping> GetFuncPageMapping(string appId)
        {
            return null;
        }

        public virtual FlowResult GetNextFlowCode(string roleId,
            string manager,
            string areaCode,
            string classId,
            string flowCode,
            OptType optType)
        {
            return null;
        }

        public virtual string GetFlowCodeTitle(string areaCode, string classId, string flowCode)
        {
            return string.Empty;
        }

        #region 获取变更列表 2013-11-4 毛凯
        /// <summary>
        /// 获取变更列表 2013-11-4 毛凯
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetChangeRecords(string condition, int pageNum, int pageSize, string areaCode)
        {
            return string.Empty;
        }
        public virtual int GetChangeRecordsCount(string condition, string areaCode)
        {
            return 0;
        }
        #endregion
        /// <summary>
        /// 取得统计--企业和人员类型
        /// </summary>
        /// <param name="rootCode"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetSysStaticSettings(string rootCode, string areaCode)
        {
            return null;
        }

        #region 根据用户角色获取所有流程状态
        public virtual string GetAllFlowStatus(string areaCode, string roleId, string classId, out string msg)
        {
            msg = string.Empty;
            return string.Empty;
        }

        public virtual string GetAllStatusFlowCodesByTitle(string roleID, string areaCode, string classId, out string msg)
        {
            msg = string.Empty;
            return string.Empty;
        }

        public virtual string GetAllBusinessStatusAndProcessing(string roleID, string areaCode, string classId, out string msg, bool contiansAll = false)
        {
            msg = string.Empty;
            return string.Empty;
        }

        public virtual string GetAllBusinessStatus(string areaCode, string classId, out string msg)
        {
            msg = string.Empty;
            return string.Empty;
        }

        public virtual int CheckCreater(string areaCode, string classId, string roleID, out string msg)
        {
            msg = string.Empty;
            return 0;
        }
        #endregion

        public virtual bool IsAppRightValid(int AppID, Guid UserGuid)
        {
            return false;
        }
        /// <summary>
        /// 根据地区编号取得地区名称
        /// </summary>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetAreaCodeTitle(string areaCode)
        {
            return null;
        }

        #region 即时通讯

        public virtual bool SendMsg(DTO.T_Msg_SentMsg msg)
        {
            return true;
        }

        public virtual List<DTO.T_Msg_SentMsg> GetMsgs(string Receiver, string Sender, int AppID, DateTime? LastSearchTime
            , Boolean? IsRead, bool DoRead, string AreaCode)
        {
            return null;
        }

        public virtual string GetMsgUser(string areaCode, List<int> classIds, List<int> manageRoleIds)
        {
            return null;
        }

        public virtual bool MsgsDelete(string CurrentUser, int AppID, string msgIds)
        {
            return true;
        }

        public virtual bool SendChat(DTO.T_Chat_ChatInfo chatInfo)
        {
            return true;
        }

        public virtual List<DTO.T_Chat_ChatInfo> GetChatInfos(string Receiver, string Sender, int AppID, DateTime? LastSearchTime
            , Boolean? IsRead, bool DoRead, string AreaCode)
        {
            return null;
        }

        public virtual List<DTO.T_Chat_ChatInfo> GetChatHistory(string Receiver, string Sender, int AppID, DateTime? StartTime
            , DateTime? EndTime, string AreaCode)
        {
            return null;
        }

        public virtual List<DTO.T_Msg_SentMsg> GetLetterBrief(string Receiver, int MaxCount, int AppID)
        {
            return null;
        }

        public virtual List<DTO.T_Chat_ChatInfo> GetChatBrief(string Receiver, int MaxCount, int AppID)
        {
            return null;
        }

        #endregion

        #region 获取系统配置
        public virtual DTO.SysApplication GetApplicationConfig(string appId)
        {
            return null;
        }
        #endregion

        public virtual IList<DTO.T_Sys_Dict> GetSysDicts(string rootCode, string parentSID)
        {
            return null;
        }

        #region 专家登录
        public virtual UserInfo DoExpertLogin(string idNum, string passWord, string appId)
        {
            return null;
        }
        #endregion

        #region 老专家登陆
        public virtual UserInfo CheckEmpInfo(string CerdentialsCode, string phone)
        {
            return null;
        }
        #endregion

        #region 专家分库
        public virtual List<DTO.T_Sys_Dict> GetExpertDBList()
        {
            return null;
        }
        public virtual string GetExpertDBName(string code)
        {
            return null;
        }
        #endregion

        public virtual bool ResetPwdByTel(string phoneNum, string newPwd)
        {
            return true;
        }

        #region 新变更方法

        /// <summary>
        /// 取得变更项选择下拉列表
        /// </summary>
        /// <param name="changeType"></param>
        /// <param name="appId"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetChangeItemsNew(string changeType, int parentId, string appId, string areaCode)
        {
            return null;
        }
        /// <summary>
        /// 取得变更内容列表
        /// </summary>
        /// <param name="changItemId"></param>
        /// <returns></returns>
        public virtual DTO.OperationResult GetChangItemsValues(string changItemId, string objectId, string areaCode)
        {
            return null;
        }
        /// <summary>
        /// 取得变更集及其包含的变更项
        /// </summary>
        /// <param name="changeSetId"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetChangeDetailsNew(int changeSetId, string areaCode)
        {
            return null;
        }

        /// <summary>
        /// 根据id或父id取得一级变更项或二级变更项列表
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="id"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual string GetChangeItemsForIDNew(int changItemId, string areaCode)
        {
            return null;
        }
        /// <summary>
        /// 取得变更前值
        /// </summary>
        /// <param name="changeItem"></param>
        /// <param name="appId"></param>
        /// <param name="areaCode"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public virtual string GetBeforeChangeValueNew(string changeItemId, string areaCode, params string[] parameters)
        {
            return null;
        }

        /// <summary>
        /// 取得变更后值
        /// </summary>
        /// <param name="changeItem"></param>
        /// <param name="appId"></param>
        /// <param name="areaCode"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public virtual Dictionary<string, string> GetBindChangeValueNew(string changeItemId, string areaCode, params string[] parameters)
        {
            return null;
        }

        /// <summary>
        /// 添加变更申请
        /// </summary>
        /// <param name="changeInfo"></param>
        /// <returns></returns>
        public virtual DTO.OperationResult AddChangeNew(string changeSetInfo, string changeInfo, int codeType, string areaCode)
        {
            return null;
        }

        /// <summary>
        /// 修改变更申请
        /// </summary>
        /// <param name="changeSetInfo"></param>
        /// <param name="changeInfo"></param>
        /// <param name="userGuid"></param>
        /// <param name="userName"></param>
        /// <param name="codeType"></param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public virtual DTO.OperationResult EditChangeNew(string changeSetInfo, string changeInfo, string roleId, int codeType, string areaCode)
        {
            return null;
        }

        /// <summary>
        /// 变更申请上报
        /// </summary>
        /// <param name="changeIds"></param>
        /// <returns></returns>
        public virtual DTO.OperationResult SubmitChangeNew(string changeIds, string changeSetInfo, string changeInfo, string userGuid, string userName, string roleId, int codeType, string areaCode)
        {
            return null;
        }

        #endregion

        public virtual IList<DTO.ChangeDetail> GetChangeSetRecordList(out int cnt, int pageNo, int pageSize, string conditions, string areaCode)
        {
            cnt = 0;
            return null;
        }

        #region 获取条款
        //条款查询
        public virtual string GetEScoreType(int bKind, int bType, string Areacode, string condtion)
        {
            return null;
        }

        public virtual string GetScore(string itemID)
        {
            return string.Empty;
        }

        public virtual DTO.ScoreItem Gete_ScoreTypeByTypeID(int typeid)
        {
            return null;
        }
        //子条款查询
        public virtual string GetEScore(int typeID, string condtion)
        {
            return null;
        }

        public virtual DTO.e_Score GetEScoreByID(int ID)
        {
            return null;
        }
        #endregion

        #region 烟台门户管理后台登录
        public virtual string DoBackGroundLogin(string userName, string password)
        {
            return string.Empty;
        }
        #endregion
    }
}
